/**
 * 订单管理 交易订单
 */
<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>学术论文</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 搜索筛选 -->
    <el-form :inline="true" :model="formInline" class="user-search">
      <el-form-item>
        <el-input size="small" v-model="formInline.doi" placeholder="输入doi"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input size="small" v-model="formInline.title" placeholder="输入论文标题"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
        <el-button size="small" type="primary" @click="dialogState('2')">全网资源</el-button>
      </el-form-item>
    </el-form>
    <!--列表-->
    <el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
      <el-table-column sortable prop="doi" label="doi" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="isTop" label="是否置顶" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="title" label="标题" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="author" label="作者" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="detail" label="详情" width="140" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="InfluenceFactor" label="影响因子" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="quoteNum" label="引用次数" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="concernFactor" label="关注因子" width="180" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="publicationDate" label="发表日期" width="180" show-overflow-tooltip>
      </el-table-column>
      <el-table-column align="center" label="操作" min-width="150">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">预览</el-button>
          <el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">退款</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination>
    <!-- 导入全网资源 -->
    <el-dialog title="全网资源" :visible.sync="dialogState2" width="70%" highlight-current-row @click="closeDialog('2')">
      <el-form :inline="true" :model="formInline" class="user-search">
        <el-form-item>
        <el-input size="small" v-model="pageparm.doi" placeholder="请输入需要导入的orcid论文"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button size="small" type="primary" icon="el-icon-search" @click="importDoi()">查询</el-button>
        </el-form-item>
      </el-form>
        <el-table size="small" :data="exportData"  highlight-current-row v-loading="loading" border element-loading-text="拼命加载中">
          <el-table-column align="center" label="操作" min-width="150">
            <template slot-scope="scope">
              <span v-show="scope.row.url" class="table_btn" @click="importUrl(scope.row)">查看</span>
            </template>
          </el-table-column>
          <el-table-column sortable prop="doi" label="doi" width="120" show-overflow-tooltip>
          </el-table-column>
          <el-table-column sortable prop="isTop" label="是否置顶" width="120" show-overflow-tooltip>
          </el-table-column>
          <el-table-column sortable prop="title" label="标题" width="120" show-overflow-tooltip>
          </el-table-column>
          <el-table-column sortable prop="author" label="作者" width="120" show-overflow-tooltip>
          </el-table-column>
          <el-table-column sortable prop="detail" label="详情" width="140" show-overflow-tooltip>
          </el-table-column>
          <el-table-column sortable prop="InfluenceFactor" label="影响因子" width="120" show-overflow-tooltip>
          </el-table-column>
          <el-table-column sortable prop="quoteNum" label="引用次数" width="120" show-overflow-tooltip>
          </el-table-column>
          <el-table-column sortable prop="concernFactor" label="关注因子" width="180" show-overflow-tooltip>
          </el-table-column>
          <el-table-column sortable prop="publicationDate" label="发表日期" width="180" show-overflow-tooltip>
          </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import Pagination from '../../components/Pagination'
export default {
  data() {
    return {
      dialogState1: false,
      dialogState2: false,
      loading: false, //是显示加载
      editFormVisible: false, //控制编辑页面显示与隐藏
      title: '预览',
      editForm: {
        id: '',
        name: '',
        payType: 1,
        partner: '',
        subMchId: '',
        appid: '',
        notifyUrl: '',
        signType: '',
        partnerKey: '',
        sellerUserId: '',
        certPath: '',
        certPassword: '',
        rsaKey: '',
      },
      formInline: {
        page: 1,
        limit: 10,
        machineNo: '',
        orderNo: '',
        transId: '',
        payType: 0,
        orderStatus: 0,
      },
      // 删除部门
      seletedata: {
        ids: '',
      },
      userparm: [], //搜索权限
      listData: [], //用户数据,
      exportData: [
        {
          url:'https://doi.org/10.1200/JCO.22.00738',
          doi:'11223'
        },
        {
          doi:'333323',
          url:''
        }
      ], //导入数据
      // 分页参数
      pageparm: {
        doi:'',
        currentPage: 1,
        pageSize: 10,
        total: 10
      }
    }
  },
  // 注册组件
  components: {
    Pagination
  },
  created() {
  },
  methods: {
    importUrl(row){
      const urlData = row.url;
      window.open(urlData,'_blank');
    },
    dialogState(state){
      if(state == '1'){
        this.dialogState1 = true;
      }
      if(state == '2'){
        this.dialogState2 = true;
      }
    },
    // 分页插件事件
    callFather(parm) {
      this.formInline.page = parm.currentPage
      this.formInline.limit = parm.pageSize
      this.getdata(this.formInline)
    },
    // 搜索事件
    search() {
      this.getdata(this.formInline)
    },
    //显示编辑界面
    handleEdit: function(index, row) {
      this.editFormVisible = true
      this.editForm = row
    },
    // 编辑、增加页面保存方法
    submitForm(editData) {
      this.$refs[editData].validate(valid => {
        if (valid) {
          ConfigSave(this.editForm)
            .then(res => {
              this.editFormVisible = false
              this.loading = false
              if (res.success) {
                this.getdata(this.formInline)
                this.$message({
                  type: 'success',
                  message: '公司保存成功！'
                })
              } else {
                this.$message({
                  type: 'info',
                  message: res.msg
                })
              }
            })
            .catch(err => {
              this.editFormVisible = false
              this.loading = false
              this.$message.error('支付配置信息保存失败，请稍后再试！')
            })
        } else {
          return false
        }
      })
    },
    // 删除公司
    deleteUser(index, row) {
      this.$confirm('确定要删除吗?', '信息', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      })
        .then(() => {
          ConfigDelete(row.deptId)
            .then(res => {
              if (res.success) {
                this.$message({
                  type: 'success',
                  message: '公司已删除!'
                })
                this.getdata(this.formInline)
              } else {
                this.$message({
                  type: 'info',
                  message: res.msg
                })
              }
            })
            .catch(err => {
              this.loading = false
              this.$message.error('支付配置信息删除失败，请稍后再试！')
            })
        })
        .catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          })
        })
    },
    // 关闭编辑、增加弹出框
    closeDialog(formName) {
      this.editFormVisible = false
      this.$refs[formName].resetFields()
    }
  }
}
</script>

<style scoped>
.user-search {
  margin-top: 20px;
}
.userRole {
  width: 100%;
}
.table_btn {
  color: #3A7BFF;
  padding: 5px;
  cursor: pointer;
}
</style>

 
 

 